#pragma once

#include "Common/MessageDispatch/MessageDispatch.h"
#include "Common/Event/Event.h"

class LogicSystemModule : public IServerMessageHandler, public IClientMessageHandler,public IEventExecuteSink
{
public:
	bool Init();
	void UnInit();
	//////////////////////////////  IServerMessageHandler ////////////////////////////////////////////
	virtual void		onServerMessage(uint32_t actionId, RECV_PACKAGE &package);
	virtual const char* getServerHandlerDebugInfo(void){ return "SystemModule::onServerMessage"; }
	//////////////////////////////  IClientMessageHandler ////////////////////////////////////////////
	virtual void		onClientMessage(uint32_t actionId, RECV_PACKAGE& package, uint64_t Id = 0);
	virtual const char* getClientHandlerDebugInfo(void){ return "LogicSystemModule::onServerMessage"; };
	///////////////////////////////// IEventExecuteSink /////////////////////////////////////////
	virtual void OnExecute(uint16_t nEventID, uint64_t nSrcID, uint8_t bySrcType, void *pContext, int32_t nLen);

private:
	//中心服广播消息
	//中心服向逻辑服同步全服数据
	bool CenterToLogic_SyncGlobalData(RECV_PACKAGE &package);
	//中心服向逻辑服返回全服数据
	bool CenterToLogic_GlobalDataRet(RECV_PACKAGE &package);
	//网关通知逻辑服玩家下线
	bool GateToLogicPlayerLoginOut(RECV_PACKAGE &package);
	//中心服通知逻辑服 断开连接
	bool CenterToLogicDisconnect(RECV_PACKAGE &package);
	//中心服通知重连成功
	bool CenterToLogicReconnectSucceed(RECV_PACKAGE &package);
	//网关通知逻辑服注册结果
	bool GateToLogicRegisterResult(RECV_PACKAGE &package);
	//中心服同通知逻辑注册结果
	bool CenterToLogicRegisterResult(RECV_PACKAGE &package);
public:
	LogicSystemModule();
	virtual ~LogicSystemModule();
};
